var Fight,
  __extends =
    (this && this.__extends) ||
    (function () {
      var t = function (i, o) {
        return (t =
          Object.setPrototypeOf ||
          ({ __proto__: [] } instanceof Array &&
            function (t, i) {
              t.__proto__ = i;
            }) ||
          function (t, i) {
            for (var o in i)
              Object.prototype.hasOwnProperty.call(i, o) && (t[o] = i[o]);
          })(i, o);
      };
      return function (i, o) {
        function n() {
          this.constructor = i;
        }
        if ("function" != typeof o && null !== o)
          throw new TypeError(
            "Class extends value " + String(o) + " is not a constructor or null"
          );
        t(i, o),
          (i.prototype =
            null === o
              ? Object.create(o)
              : ((n.prototype = o.prototype), new n()));
      };
    })();
!(function (t) {
  var i = (function (t) {
    function i() {
      var i = t.call(this) || this;
      return (
        (i.isInit = !1),
        (i.isLoad = !1),
        (i.lastAction = null),
        (i.width = 54),
        (i.height = 64),
        (i.body = new Laya.Animation()),
        (i.body.interval = 100),
        (i.body.width = 54),
        (i.body.height = 64),
        i.addChild(i.body),
        i
      );
    }
    return (
      __extends(i, t),
      (i.prototype.init = function (t, o) {
        if (!this.isLoad)
          return (
            (this.imgName = t),
            (this.atlas = i.path + t + ".atlas"),
            void Laya.loader.load(
              this.atlas,
              Laya.Handler.create(this, this.onLoad),
              null,
              Laya.Loader.ATLAS
            )
          );
        this.pos(this.t_x, this.t_y),
          (this.scaleX = this.t_scaleX),
          (this.isInit = !0),
          null != this.lastAction && this.onceAction(this.lastAction);
      }),
      (i.prototype.thePos = function (t, i, o) {
        (this.t_x = t), (this.t_y = i), (this.t_scaleX = o);
      }),
      (i.prototype.payAction = function (t) {
        this.body.play(0, !0, this.imgName + "_" + t);
      }),
      (i.prototype.onceAction = function (t) {
        this.isInit ? this.payAction(t) : (this.lastAction = t);
      }),
      (i.prototype.onLoad = function (t) {
        if (i.isCache[this.imgName])
          return (this.isLoad = !0), void this.init(null, null);
        Laya.Animation.createFrames(
          this.aniUrls("idle", 4),
          this.imgName + "_idle"
        ),
          (i.isCache[this.imgName] = !0),
          (this.isLoad = !0),
          this.init(null, null);
      }),
      (i.prototype.aniUrls = function (t, i) {
        for (var o = [], n = 1; n <= i; n++)
          o.push("fight/horse/" + this.imgName + "/" + t + n + ".png");
        return o;
      }),
      (i.prototype.stopPlay = function () {
        (this.isInit = !1),
          (this.isLoad = !1),
          (this.visible = !1),
          this.body.stop();
      }),
      (i.path = "res/atlas/fight/horse/"),
      (i.isCache = {}),
      i
    );
  })(Laya.Sprite);
  t.FightHorse = i;
})(Fight || (Fight = {}));
